package com.bjpowernode.controller;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;

public class TwoServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String result = "Hello World";
        PrintWriter out = resp.getWriter();
        out.write(97);

        // 通过请求对象 获取所有请求参数的名称
        Enumeration<String> parameterNames = req.getParameterNames();
        while (parameterNames.hasMoreElements()){
            String paramName = (String)parameterNames.nextElement();
            String parameter = req.getParameter(paramName);
            System.out.println("请求参数名 " + paramName);
            System.out.println("请求参数值 " + parameter);
        }
    }

}
